import addBypassAccount from '@/mock/mockApi/addBypassAccount'
import addDish from '@/mock/mockApi/addDish'
import addFacility from '@/mock/mockApi/addFacility'
import addGroup from '@/mock/mockApi/addGroup'
import addLawCase from '@/mock/mockApi/addLawCase'
import addUserDish from '@/mock/mockApi/addUserDish'
import addUserFacility from '@/mock/mockApi/addUserFacility'
import adminChangePassword from '@/mock/mockApi/adminChangePassword'
import adminLogin from '@/mock/mockApi/adminLogin'
import adminRegister from '@/mock/mockApi/adminRegister'
import alarmList from '@/mock/mockApi/alarmList'
import alarmStatusUpdate from '@/mock/mockApi/alarmStatusUpdate'
import checkFacility from '@/mock/mockApi/checkFacility'
import delBypassAccount from '@/mock/mockApi/delBypassAccount'
import delDish from '@/mock/mockApi/delDish'
import delFacility from '@/mock/mockApi/delFacility'
import delUserDish from '@/mock/mockApi/delUserDish'
import delUserFacility from '@/mock/mockApi/delUserFacility'
import editGroup from '@/mock/mockApi/editGroup'
import editLawCase from '@/mock/mockApi/editLawCase'
import endLawCase from '@/mock/mockApi/endLawCase'
import facilityInfo from '@/mock/mockApi/facilityInfo'
import immediatelyPosition from '@/mock/mockApi/immediatelyPosition'
import lawCaseInfo from '@/mock/mockApi/lawCaseInfo'
import lawCaseList from '@/mock/mockApi/lawCaseList'
import listGroup from '@/mock/mockApi/listGroup'
import listUserDish from '@/mock/mockApi/listUserDish'
import listUserFacility from '@/mock/mockApi/listUserFacility'
import trackView from '@/mock/mockApi/trackView'
import updateAccountType from '@/mock/mockApi/updateAccountType'
import updateDish from '@/mock/mockApi/updateDish'
import userBypassList from '@/mock/mockApi/userBypassList'
import witnessLanding from '@/mock/mockApi/witnessLanding'
import sendIns from '@/mock/mockApi/sendIns'

let result = {
  addBypassAccount,
  addDish,
  addFacility,
  addGroup,
  addLawCase,
  addUserDish,
  addUserFacility,
  adminChangePassword,
  adminLogin,
  adminRegister,
  alarmList,
  alarmStatusUpdate,
  checkFacility,
  delBypassAccount,
  delDish,
  delFacility,
  delUserDish,
  delUserFacility,
  editGroup,
  editLawCase,
  endLawCase,
  facilityInfo,
  immediatelyPosition,
  lawCaseInfo,
  lawCaseList,
  listGroup,
  listUserDish,
  listUserFacility,
  trackView,
  updateAccountType,
  updateDish,
  userBypassList,
  witnessLanding,
  sendIns
}

const request = async (constApi, ...args) => {
  //constApi: url
  //args: params
  //result[constApi.code]: result
  // console.log('REQUEST-MOCK',constApi,args,result[constApi.code])
  console.log(constApi.code, result[constApi.code])
  return result[constApi.code] || console.error(...args)
}

window.Api = {
  request
}
